package com.zdlyh.controller;

import com.zdlyh.domain.ResponseResult;
import com.zdlyh.service.MinioService;
import com.zdlyh.service.UploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
public class UploadController {
    /*@Autowired
    private UploadService uploadService;*/

    @Autowired
    private MinioService minioService;

    @PostMapping("/upload")
    public ResponseResult uploadImg(MultipartFile img){
        try {
            return minioService.uploadImg(img);
        }catch (Exception e){
            e.printStackTrace();
            throw new RuntimeException("文件上传失败");
        }
    }
}
